package denkmalVerwaltungstool.backend.tokenizer;

import java.io.File;
import java.io.IOException;
import java.util.StringTokenizer;

import denkmalVerwaltungstool.backend.fileHandler.FRead;
import denkmalVerwaltungstool.backend.tokenizer.token.Tokenlist;

public class Tokenizer {
	
	private Tokenlist token;
	private String fileCache;
	private FRead fileReader;
	private String delims;
	
	public Tokenizer(){
		this.token = new Tokenlist();
		this.delims = "\n";
	}

	public void importFile(File file){
		this.fileReader = new FRead(file);
		try {
			this.fileCache = fileReader.readerToString();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// System.out.println(this.fileCache);
		
		StringTokenizer tok = new StringTokenizer(fileCache,delims);
		while (tok.hasMoreElements()){
			System.out.println(tok.nextToken());
			//token.addToken(tok.nextToken());
		}
		
		
	}
	
	/**
	 * @return the token
	 */
	public Tokenlist getToken() {
		return token;
	}

	/**
	 * @return the delims
	 */
	public String getDelims() {
		return delims;
	}

	/**
	 * @param delims the delims to set
	 */
	public void setDelims(String delims) {
		this.delims = delims;
	}

	
	
	
}
